﻿#region Using Statemens
using System;
using System.Collections.Generic;
using GameBase.Screens;
using StarFox.ScreenComponents;
#endregion

namespace StarFox.Screens
{
    /// <summary>
    /// Pause menu screen of the game.
    /// </summary>
    public class PauseMenuScreen : StarFoxScreen
    {
        #region Initialization

        /// <summary>
        /// Initializes a new instance of this class.
        /// </summary>
        /// <param name="screenManager">The ScreenManager that this screen should be attached to.</param>
        public PauseMenuScreen(ScreenManager screenManager)
            : base(screenManager)
        {
            Name = "PauseMenuScreen";
        }

        /// <summary>
        /// Called when the Screen needs to be initialized.
        /// </summary>
        public override void Initialize()
        {
            Components3D.Add(new MenuBackground(this) { Duration = TimeSpan.FromSeconds(6) });

            GamePlayMenu menu = new GamePlayMenu(this);
            // menu title
            menu.MenuTitle = "TITLE_PAUSE_MENU";
            // menu items
            List<GamePlayMenu.IMenuItem> auxMenuItems = new List<GamePlayMenu.IMenuItem>();
            auxMenuItems.Add(new GamePlayMenu.LinkItem("ITEM_RESUME", new GamePlayMenu.ButtonMessage[] { GamePlayMenu.ButtonMessage.SELECT, GamePlayMenu.ButtonMessage.BACK }));
            auxMenuItems.Add(new GamePlayMenu.LinkItem("ITEM_RESTART_MISSION", new GamePlayMenu.ButtonMessage[] { GamePlayMenu.ButtonMessage.SELECT, GamePlayMenu.ButtonMessage.BACK }));
            auxMenuItems.Add(new GamePlayMenu.LinkItem("ITEM_OPTIONS_2", new GamePlayMenu.ButtonMessage[] { GamePlayMenu.ButtonMessage.SELECT, GamePlayMenu.ButtonMessage.BACK }));
            auxMenuItems.Add(new GamePlayMenu.LinkItem("ITEM_QUIT", new GamePlayMenu.ButtonMessage[] { GamePlayMenu.ButtonMessage.SELECT, GamePlayMenu.ButtonMessage.BACK }));
            menu.MenuItems = auxMenuItems;
            // menu actions
            menu.MenuAccept += (sender, args) =>
            {
                #region Menu Actions

                switch (args.Index)
                {
                    case 0:
                        // resume
                        ScreenManager.RemoveScreen(this);
                        break;
                    case 1:
                        // restart mission
                        break;
                    case 2:
                        // options
                        ScreenManager.AddScreen(new OptionsMenuScreen(ScreenManager));
                        break;
                    case 3:
                        // quit
                        ScreenManager.AddScreen(new QuitScreen(ScreenManager));
                        break;
                    default:
                        break;
                }

                #endregion
            };

            Components2D.Add(menu);

            base.Initialize();
        }

        #endregion
    }
}
